<%@ page contentType="text/html;charset=UTF-8" language="java" %>
<%@ include file="/public/inc/tags.jsp"%>
<input type="hidden" value="${model.id}" id="id" name="id">
<div class="form-horizontal">
    <div class="form-group">
        <label class="control-label col-md-2">产品编号</label>
        <div class="col-md-10">
            <input id="product_id" name="product_id" class="form-control" placeholder="请输入产品编号"
                   value="${model.product_id}"/>
        </div>
    </div>
    <div class="form-group">
        <label class="control-label col-md-2">产品名称</label>
        <div class="col-md-10">
            <input id="product_name" name="product_name" class="form-control" placeholder="请输入产品名称"
                   value="${model.product_name}"/>
        </div>
    </div>
    <div class="form-group">
        <label class="control-label col-md-2">产品原价</label>
        <div class="col-md-10">
            <input id="original_price" name="original_price" class="form-control" placeholder="请输入产品原价"
                   value="${model.original_price}"/>
        </div>
    </div>
    <div class="form-group">
        <label class="control-label col-md-2">产品现价</label>
        <div class="col-md-10">
            <input id="price" name="price" class="form-control" placeholder="请输入产品现价"
                   value="${model.price}"/>
        </div>
    </div>
    <div class="form-group">
        <label class="control-label col-md-2">是否推荐</label>
        <div class="col-md-10">
            <select name="recommend" class="form-control">
                <option value="0">请选择</option>
                <option value="1" <c:if test="${model.recommend==1}"> selected="selected"</c:if>>是</option>
                <option value="0" <c:if test="${model.recommend==0}"> selected="selected"</c:if>>否</option>
            </select>
        </div>
    </div>
    <div class="form-group">
        <label class="control-label col-md-2">类型</label>
        <div class="col-md-10">
            <select name="type" id="type" class="form-control">
                <option value="0">请选择</option>
                <option value="5" <c:if test="${model.type==5}"> selected="selected"</c:if>>三天</option>
                <option value="6" <c:if test="${model.type==6}"> selected="selected"</c:if>>五天</option>
                <option value="1" <c:if test="${model.type==1}"> selected="selected"</c:if>>一周</option>
                <option value="4" <c:if test="${model.type==4}"> selected="selected"</c:if>>半月</option>
                <option value="2" <c:if test="${model.type==2}"> selected="selected"</c:if>>一月</option>
                <option value="8" <c:if test="${model.type==8}"> selected="selected"</c:if>>三月</option>
                <option value="9" <c:if test="${model.type==9}"> selected="selected"</c:if>>半年</option>
                <option value="10" <c:if test="${model.type==10}"> selected="selected"</c:if>>一年</option>
                <option value="11" <c:if test="${model.type==11}"> selected="selected"</c:if>>一百天</option>
                <option value="12" <c:if test="${model.type==12}"> selected="selected"</c:if>>单本书</option>
            </select>
        </div>
    </div>
    <div class="form-group">
        <label class="control-label col-md-2">是否可用</label>
        <div class="col-md-10">
            <select name="status" class="form-control">
                <option value="0">请选择</option>
                <option value="1" <c:if test="${model.status==1}"> selected="selected"</c:if>>是</option>
                <option value="0" <c:if test="${model.status==0}"> selected="selected"</c:if>>否</option>
            </select>
        </div>
    </div>
    <div class="form-group">
        <label class="control-label col-md-2">排序</label>
        <div class="col-md-10">
            <input id="sort" name="sort" class="form-control" placeholder="排序"
                   value="${model.sort}"/>
        </div>
    </div>
    <div class="form-group">
        <label class="control-label col-md-2">活动结束时间</label>
        <div class="col-md-10">
            <fmt:formatDate value="${model.activity_time}" var="time"/>
            <input class="form-control date-picker" readonly id="activity_time" name="activity_time" value="${time}" placeholder="格式:2000-08-08" />
        </div>
    </div>
    <div class="form-group">
        <div class="col-md-offset-2 col-md-10">
            <button type="submit" class="btn btn-primary">
                <i class="fa fa-floppy-o"></i> 保存
            </button>
        </div>
    </div>
</div>
<script type="text/javascript">
    $(document).ready(function () {

        $("#form1").bootstrapValidator({
            feedbackIcons: {
                valid: 'glyphicon glyphicon-ok',
                invalid: 'glyphicon glyphicon-remove',
                validating: 'glyphicon glyphicon-refresh'
            },
            fields: {

                product_id: {
                    validators: {
                        notEmpty: {
                            message: '不能为空'
                        }
                    }
                },
                product_name: {
                    validators: {
                        notEmpty: {
                            message: '不能为空'
                        }
                    }
                },
                original_price: {
                    validators: {
                        notEmpty: {
                            message: '不能为空'
                        }
                    }
                },
                sort: {
                    validators: {
                        notEmpty: {
                            message: '不能为空'
                        }
                    }
                },
                price: {
                    validators: {
                        notEmpty: {
                            message: '不能为空'
                        }
                    }
                }
            }
        });
    });
</script>